 /* package cn.edu.lzzy;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import org.codehaus.jettison.badgerfish.*;

import java.io.IOException;
public class HdfsDemo2 {
    public static void main(String[] args) throws IOException {
        // System.out.println("holle wold");
        // 1 创建Configuration对象，赋值给conf变量

        boolean isR = false;
        String targetDir = "";

        if (args.length == 1) {
            targetDir = args[0];
        } else {
            if (!"-R".equals(args[0])) {
                throw new RuntimeException("传有多个参数时,第一个参数必须是-R");
            }
            isR = true;
            targetDir = args[1];
        }
        Configuration conf = new Configuration();
        conf.set("fs.defaultFS",
                "hdfs://803425-hadoop01:9000/");
        // 2 获取文件系统对象
        FileSystem fs = FileSystem.get(conf);


       tree(fs, new Path(targetDir),isR);
        // 3 查看指定路径文件信息
        fs.close();

         /**
          递归查询指定路径的所有文件路径
          @param fs
         * @param path
         * @throws IOException
         */
     /*   public static void tree (FileSystem fs, Path p, boolean isR) throws IOException {
            FileStatus[] fileStatuses = fs.listStatus(p);

            for (FileStatus fileStatus : fileStatuses) {
                System.out.println(fileStatus.getPath());
                if (fileStatus.isDirectory()) {
                    tree(fs, fileStatus.getPath(), isR);
                }
            }
        }
    }
}

      */
